import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
//引入vuex
import Vuex from "vuex"
Vue.use(Vuex)
//按需引入
/* import { Header,Swipe,SwipeItem,Button,Lazyload } from 'mint-ui'
Vue.component(Header.name,Header)
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);
Vue.component(Button.name, Button);
Vue.use(Lazyload); */
//全部导入
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(MintUI)
//引入mui文件
import "./assets/lib/css/mui.min.css"
//引入mui的图标样式
import "./assets/lib/css/icons-extra.css"
//引入axios
import axios from "axios"
Vue.prototype.axios = axios
//配置全局
axios.defaults.baseURL = 'http://www.liulongbin.top:3005';
//引入vue-preview缩放图插件
import VuePreview from 'vue-preview'
// defalut install
Vue.use(VuePreview)
//引入处理时间的插件
import moment from "moment"
//定义全局时间过滤器
Vue.filter("deteFoemat", function (dataStr, pattern = "YYYY-MM-DD HH:mm:ss") {
  //要return
  return moment(dataStr).format(pattern)
})

Vue.config.productionTip = false
//登录拦截
axios.interceptors.request.use(
  config => {
      if (localStorage.getItem("token")) {  // 判断是否存在token，如果存在的话，则每个http header都加上token
          config.headers.Authorization = localStorage.getItem("token");
      }
      return config;
  },
  err => {
      return Promise.reject(err);
  });
new Vue({
  router,
  store,
  render: h => h(App),
  store
}).$mount('#app')
